<template>
  <div id="CarList">
    <!-- <mt-loadmore :top-method="loadTop" :bottom-method="loadBottom" :bottom-all-loaded="allLoaded" ref="loadmore"> -->
    <ul>
      <li v-for="(item,index) in CarList" :key="index">
        <a href="javascript:void(0)" @click="getCarDetail('CarDetail',item.goodsId)">
          <div class="carImgBg" :style="{backgroundImage:'url('+item.imgUrl+')'}"></div>
          <div class="carInfo">
            <p class="type ellipsis-2 PingFang">{{item.carModelName}}</p>
            <p
              class="city ellipsis-1"
            >{{item.carCityName}} / {{item.registerTime}} / {{(item.mileage/10000).toFixed(2)}}万公里</p>
            <span class="price">{{(item.retailPrice/10000).toFixed(2)}}万</span>
            <div class="dataBox">
              <span class="size">{{item.dischargeLevel}}</span>
              <span>2018-08-08</span>
            </div>
          </div>
        </a>
      </li>
    </ul>
    <!-- </mt-loadmore> -->
  </div>
</template>
<script>
import {} from "element-ui";
import { getReq } from "../../assets/js/api";
import dict from "../../assets/js/utils.js";
export default {
  data() {
    return {
      miniStoreId: this.$route.query.miniStoreId,
      CarList: []
    };
  },
  components: {},
  methods: {
    // 获取店铺在售列表
    getShopDeatil() {
      var params = {
        miniStoreId: this.miniStoreId
      };
      getReq("/b2c/store/getStoreDetailInfo", params).then(res => {
        let { errcode, message, content } = res;
        if (errcode == 0) {
          this.CarList = content.goodsVo;
          this.CarList.map((item, index) => {
            item.dischargeLevel = dict.dischargeLevel[item.dischargeLevel];
          });
        } else {
          Toast({
            message: message
          });
        }
      });
    },
  
    // 点击跳转车辆详情
    getCarDetail(name, orderId) {
      this.$router.push({
        name: name,
        query: {
          orderId: orderId
        }
      });
    }
  },
  mounted() {
    this.getShopDeatil();
  }
};
</script>
<style type="text/css" lang='scss'>
#CarList {
  ul {
    padding: 10px 15px;
    li {
      border-bottom: 1px solid rgba(248, 248, 248, 1);
      padding: 10px 0;
      margin-bottom: 0px;
      a {
        padding-top: 10px;
        width: 100%;
        display: flex;
        padding-bottom: 10px;
        height: 127px;
        .carInfo {
          width: 68%;
          float: left;
          height: 105px;
        }
      }

      .carImgBg {
        float: left;
        width: 28%;
        height: 105px;
        margin-right: 2%;
      }
      p.type {
        height: 34px;
        color: #323232;
        font-size: 1.25rem;
        line-height: 1.4rem;
      }
      p.city {
        color: #666;
        // margin: 2px 0;
      }
      span.price {
        color: #0098ff;
        font-size: 1.416667rem;
        font-weight: bold;
        // margin-bottom: 2px;
      }
      .dataBox {
        display: flex;
        justify-content: space-between;
        align-items: center;
        span {
          color: rgba(153, 153, 153, 1);
          font-size: 0.916667rem;
        }
        .size {
          color: #666;
          border-radius: 2px;
          border: 1px solid rgba(102, 102, 102, 1);
          padding: 0.5px 3px;
        }
      }
    }
  }
}
</style>

